Video compressing refers to a process for converting a video sequence of a certain format into a video sequence of another format, by using a specific compressing technology.
Current video compression standards mainly include H.261, H.263 stipulated by International Telecommunication Union-Telecommunication Sector (ITU-T), Moving Pictures Experts Group-1 (MPEG-1) and MPEG-4 stipulated by International Standards Organization (ISO), and MPEG-2/H.262 jointly stipulated by ITU-T and ISO, and so on. Each foregoing standard adopts a block-based hybrid encoding framework, and one important technology therein is predictive encoding.
Generally, based on different sources of prediction data, each image frame in a video sequence is divided into following three types: I frame (intra prediction frame, Intra), P frame (inter prediction frame, Prediction), B frame (bi-direction prediction frame, Bi-prediction). Correspondingly, an image in the type of I frame is referred to as an I-frame image. An image in the type of P frame is referred to as a P-frame image. An image in the type of B frame is referred to as a B-frame image.
When performing the predictive encoding on an I-frame image, it is necessary to adopt data of a local frame. When performing the predictive encoding on a P-frame image, it is necessary to take at least one preceding image frame as the reference image frame. When performing the predictive encoding on a B-frame image, it is necessary to take at least one preceding image frame, or at least one subsequent image frame as the reference image frame. The reference image frame needs to be a re-constructed image. The re-constructed image refers to a decoded image, after being encoded.
FIG. 1 is a schematic diagram illustrating a reference image frame of current P-frame image. As shown in FIG. 1, when performing a predictive encoding on the second P-frame image is required (according to the order from left to right), two preceding image frames may be taken as reference image frames.
FIG. 2 is a schematic diagram illustrating a reference image frame of current B-frame image. As shown in FIG. 2, when performing a predictive encoding on a B-frame image therein is required, preceding two frame (forward reference frame) images and one subsequent frame (backward reference frame) image may be taken as reference image frames.
In practical applications, a predictive encoding mode corresponding to foregoing I-frame image is generally referred to as an intra predictive encoding. Predictive encoding modes corresponding to foregoing P-frame image and B-frame image are referred to as inter predictive encoding. The intra predictive encoding refers to predicting with data of a local frame. However, the inter predictive encoding refers to predicting with data of other frames.
Compared with the inter predictive encoding, encoding efficiency of the intra predictive encoding is lower, which may increase encoded rate, thereby increasing costs of transmission and storage.
In current processing methods, when performing intra predictive encoding on a certain image frame x of a video sequence, resolution of a reference image frame is required to be the same as resolution of image x. When the resolution of the reference image frame is different from the resolution of image x, it is considered that the video sequence has been switched. And processes are performed based on a new video sequence, i.e., take an I-frame image randomly accessed as a starting point. That is, when resolution of reference image frame is the same as resolution of image x, perform the inter predictive encoding on image x based on a normal mode; otherwise, perform the intra predictive encoding on image x.
Resolution refers to pixel number of width and height of an image. Suppose the resolution of image x is 704*576, 704 refers to horizontal pixel number of image x, and 576 refers to vertical pixel number of image x.
FIG. 3 is a schematic diagram illustrating resolution change of each image frame in a video sequence at present. As shown in FIG. 3, according to the order from left to right, in ideal conditions, it is hoped that except for the first image frame being the I-frame image, the remaining image frames are the P-frame images. However, resolution of the fourth image frame is greater than resolution of the third image frame. Resolution of the sixth image frame is less than resolution of the fifth image frame. Suppose the third image frame is the reference image frame of the fourth image frame, the fifth image frame is the reference image frame of the sixth image frame, due to difference with resolution of the reference image frame, the inter predictive encoding cannot be performed on the fourth image frame and the sixth image frame, what is allowed is the intra predictive encoding. That is, take the fourth image frame and the sixth image frame as the I-frame images to be processed.
In view of above, when performing a video compressing on a certain video sequence, if resolution of each image frame therein is the same, there is no problem. If resolution of each image frame therein changes frequently, e.g., in extreme cases, resolution of each image frame is different, only the intra predictive encoding is allowed to be performed on each image frame. As described above, encoding efficiency of the intra predictive encoding is lower, thereby increasing the bit rate after encoding, and further increasing costs of transmission and storage.